import request from "@/request";

export default {
  // 供应信息列表
  getSupplyList(params) {
    return request({
      url: "/customer/supply/list",
      method: "get",
      params,
    });
  },
  // 供应信息列表
  getSupplyNormalList(params) {
    return request({
      url: "/supply/list",
      method: "get",
      params,
    });
  },
  // 供应信息详情
  getSupplyDetail(id) {
    return request({
      url: `/customer/supply/${id}`,
      method: "get",
    });
  },
  // 需求信息列表
  getDemandList(params) {
    return request({
      url: "/customer/demand/list",
      method: "get",
      params,
    });
  },

  // 需求信息详情
  getDemandDetail(id) {
    return request({
      url: `/customer/demand/${id}`,
      method: "get",
    });
  },
  // 申请资源
  applySupply(data) {
    return request({
      url: "/resource/order",
      method: "post",
      data,
    });
  },
  // 取消申请
  cancelApply(id) {
    return request({
      url: "/resource/order/cancel",
      method: "put",
      data: { id },
    });
  },
  createDemand(data) {
    return request({
      url: "/demand",
      method: "post",
      data,
    });
  },
  updateDemand(data) {
    return request({
      url: "/demand",
      method: "put",
      data,
    });
  },
  createSupply(data) {
    return request({
      url: "/supply",
      method: "post",
      data,
    });
  },
  updateSupply(data) {
    return request({
      url: "/supply",
      method: "put",
      data,
    });
  },
  toggleSupply(data) {
    return request({
      url: "/supply/updateStatus",
      method: "put",
      data,
    });
  },
  checkCompletePhone(params) {
    return request({
      url: "/demand/mobileSearch",
      method: "get",
      params,
    });
  },
  toggleDemand(data) {
    return request({
      url: "/demand/updateStatus",
      method: "put",
      data,
    });
  },
  applyDemand(params) {
    return request({
      url: "/cooperation/supply",
      method: "post",
      params,
    });
  },
};
